<?php
/** 取得整站新闻类别
* @return Array
*/
function getAryNewsType()
{
	$ss=array(
	'0'=>'关于我们'
	,'1'=>'联系我们'
	,'2'=>'帮助中心'
	,'3'=>'系统公告'
	);
	return $ss;
}
/**
* 取得相关类别的新闻信息
* @param newstype_id	新闻类别
* @param num			新闻数量
* @param language		语言
* Return Array
*/
function getNewsList($newstype_id=1,$num,$language=1)
{
	$t=new Tbl_Act('web_newslist','id');		//创建表对象
	$rows=$t->GetAll('news_title,news_title2,news_title3,news_url,html_url,news_img,news_creattime'," where newstype_id='$newstype_id' and language='$language' limit 0,$num");
	return $rows;
}

/**
* 取得相关类别的新闻信息
* @param newsid 新闻id
* Return Object
*/
function getNewsContent($newsid)
{
	$t=new Tbl_Act('web_newslist','id');		//创建表对象
	$t->id=$newsid;
	$t->GetOne(array('id,='));
	return $t;
}

/**
* 取得热点新闻信息
* @param newstype		新闻类别id
* @param num		取得新闻的数量
* @return String
*/
function getHotNewsInfo($newstype='',$num="1")
{
	global $db;
	if($newstype!='')
	{
		$conv=" and newstype_id='$newstype'";
	}
	else
	{
		$conv='';
	}
	$sql=" select id,news_title,news_url,news_img,news_content_dre from web_newslist where isdel=0$conv and news_istop='1' order by id desc limit 0,$num";
	//echo $sql;
	$rs=$db->Execute($sql);
	$i=0;
	while($rs && $row=$rs->FetchRow())
	{
		$ss[$i]=$row;
		$ss[$i]['news_img']=WEBDOMAIN.'/manage/'.$row['news_img'];
		//$ss[$i]['url']=$row['news_url']==''?WEBDOMAIN.'/news/indexView.php?id='.$row['id']:$row['news_url'];
		$ss[$i]['url']=$row['news_url']==''?WEBDOMAIN.'/html/news/news_'.$row['id'].'.html':$row['news_url'];
		$i++;
	}
	return $ss;
}

/**
* 取得热点新闻信息
* @param newstype		新闻类别id
* @param num		取得新闻的数量
* @return String
*/
function getNewsInfo($newstype="",$num="1")
{
	global $db;
	$sql="select id,news_title,news_url,news_img,news_content_dre from web_newslist where isdel=0";
	if(!empty($newstype))
	{
		$sql.=" and newstype_id='$newstype'";
	}
	 $sql.=" order by id desc limit 0,$num";
	//echo $sql;
	$rs=$db->Execute($sql);
	$i=0;
	while($rs && $row=$rs->FetchRow())
	{
		$ss[$i]=$row;
		$ss[$i]['news_img']=WEBDOMAIN.'/manage/'.$row['news_img'];
		$ss[$i]['url']=$row['news_url']==''?WEBDOMAIN.'/html/news/news_'.$row['id'].'.html':$row['news_url'];
		$i++;
	}
	return $ss;
}
?>